/******************************************************************************
 *
 * Project:		mGameEngine
 * File:		motionblur.h
 * Author:		karooolek
 * Created on:	Dec 10, 2009
 *
 ******************************************************************************/

#ifndef MOTIONBLUR_H_
#define MOTIONBLUR_H_

#include "postprocess.h"
#include "rendertexture.h"

namespace mGameEngine
{
namespace Graphics
{

/**
 * Motion blur post-process.
 * Motion blur is effect of making moving objects appear blurry.
 * Delay specifes how long is the trail visible.
 */
class MotionBlur: public PostProcess
{
protected:
	/**
	 * Texture with last processed image.
	 */
	mutable RenderTexture _last;

	/**
	 * Timer.
	 */
	mutable Timer _timer;

	/**
	 * Delay.
	 */
	float _delay;

public:
	/**
	 * Create motion blur post-process.
	 * @param delay delay in seconds.
	 * @param texture input image texture.
	 * @param target output render target.
	 */
	MotionBlur(float delay = 0.5f,
			const Texture *texture = NULL, RenderTarget *target = NULL);

	/**
	 * Destroy motion blur post-process.
	 */
	virtual ~MotionBlur();

	/**
	 * Get motion blur delay.
	 * @return motion blur delay in seconds.
	 */
	float getDelay() const
	{
		return _delay;
	}

	/**
	 * Set motion blur delay.
	 * @param delay delay in seconds.
	 */
	void setDelay(float delay);

	/**
	 * Process input image and render output to render target.
	 */
	virtual void process() const;
};

}
}

#endif // MOTIONBLUR_H_
